﻿using MusicExplorer.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Data;

namespace MusicExplorer.Converters
{
    public sealed class QueryTypeToBooleanConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            switch((QueryType)value)
            {
                case QueryType.AllTracks:
                    return false;
                case QueryType.TopTracks:
                    return true;
                default:
                    throw new Exception("Not supported query type");
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            if ((bool)value) return QueryType.TopTracks;
            else return QueryType.AllTracks;
        }
    }
}
